<?
if (!defined('SMF'))
	die('Hacking attempt...');

function BlackNovaAdmin()
{
	global $context;
	
	loadTemplate('BlackNovaAdmin');
	loadLanguage('BlackNovaAdmin');
	
	$context['template_layers'][] = 'blacknovaadmin';

	// Some actions we can do.
	$actions = array(
		'universe_editor' => "UniverseEditor",
		'sector_editor' => "SectorEditor",
		'planet_editor' => "PlanetEditor",
		'link_editor' => "LinkEditor",
		'zone_editor' => "ZoneEditor",
		'xenobe_control' => "XenobeControl",
		'log_viewer' => "LogViewer",
		'game_reset' => "GameReset",
		'game_settings' => "GameSettings",
	);
	
	// Look for a subaction.
	$action = (isset($_GET['sa'])) ? $_GET['sa'] : 'UniverseEditor';
	
	// Make sure it is a valid subaction, otherwise go to the index.
	if (isset($actions[$action]))
		$actions[$action]();
	else
		UniverseEditor();
}	

function UniverseEditor()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_admin';
}

function SectorEditor()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_admin';
}

function PlanetEditor()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_admin';
}

function LinkEditor()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_admin';
}

function ZoneEditor()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_admin';
}

function XenobeControl()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	loadLanguage('BlackNova');
	
	$context['sub_template'] = 'blacknova_admin';
}

function LogViewer()
{
	global $context, $txt, $boarddir;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	// Load the BlackNova language file for the log viewer
	loadLanguage('BlackNova');
	
	$context['sub_template'] = 'blacknova_admin';
}

function GameSettings()
{
	global $context, $txt;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$context['sub_template'] = 'blacknova_settings';
}

function GameReset()
{
	global $context, $txt, $boarddir;
	global $smcFunc;
	global $dbTables;
	
	$context[$context['admin_menu_name']]['tab_data']['title'] = $txt['bnt_manage_game'];
	$context[$context['admin_menu_name']]['tab_data']['description'] = $txt['bnt_manage_game_desc'];
	$context['page_title'] = $txt['bnt_manage_game'];
	
	$reset_action = (isset($_POST['reset_action'])) ? $_POST['reset_action'] : '';
	
	$context['sub_template'] = 'blacknova_reset';
}
?>